package com.zhuss.core.db.dao.ext;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.zhuss.bean.bo.core.resource.SearchResourceBo;
import com.zhuss.bean.vo.core.resource.DetailResourceVo;
import com.zhuss.bean.vo.core.resource.ListResourceVo;
import com.zhuss.core.db.dao.gen.ResourceMapper;
import com.zhuss.core.db.entity.Resource;

@Mapper
public interface ResourceDao extends ResourceMapper {
	
	void create(Resource resource);

	List<Resource> listAll(@Param("type") Integer type, @Param("system") Integer system, @Param("isPublic") Integer isPublic);
	
	List<Long> listAllId(@Param("type") Integer type, @Param("system") Integer system, @Param("isPublic") Integer isPublic);
	
	List<Resource> listByParent(@Param("type") Integer type, @Param("system") Integer system, @Param("parent") Long parent);
	
	List<Long> listByParentId(@Param("type") Integer type, @Param("system") Integer system, @Param("parent") Long parent);

	List<Long> listByParentList(@Param("type") Integer type, @Param("system") Integer system, @Param("parentList") List<Long> parentList);
	
	List<Long> listAllShow(@Param("type") Integer type, @Param("system") Integer system, @Param("isPublic") Integer isPublic, @Param("isShow") Integer isShow);
	
	List<Resource> listByIdList(@Param("type") Integer type, @Param("resourceIdList") List<Long> resourceIdList);

	List<ListResourceVo> list(SearchResourceBo bo);
	
	Integer countList(SearchResourceBo bo);

	DetailResourceVo detail(@Param("resourceId") Long resourceId);

	void delete(Resource record);
	
	List<Resource> listSon(@Param("resourceId") Long resourceId);
	
	Long listParent(@Param("resourceId") Long resourceId);
	
	List<Resource> listByName(@Param("name") String name);
	
	List<Resource> listByNameAndSystem(@Param("name") String name, @Param("system") Integer system);
	
	List<Resource> listByUrl(@Param("url") String url);
	
	List<Resource> listByUrlAndSystem(@Param("url") String url, @Param("system") Integer system);
    
}